import request from '@/utils/request.js'

// 获取验证码
export function getCode (mobile) {
  return request({
    url: '/au/code',
    method: 'post',
    data: {
      mobile: mobile
    }
  })
}

// 登录
export function login (data) {
  return request({
    url: '/au/login',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUser () {
  return request({
    url: '/au/info',
    needToken: true
    // headers: {
    //   authorization: `Bearer ${token}`
    // }
  })
}

// 修改用户信息
export function editUser (data) {
  return request({
    url: '/au/edit',
    method: 'POST',
    needToken: true,
    data
  })
}

// 发起上传请求
export function upload (file) {
  const fd = new FormData()
  fd.append('files', file)
  return request({
    url: '/upload',
    method: 'POST',
    needToken: true,
    data: fd
  })
}
